<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3">
<head>
    <title>毕业生跟踪回访系统</title>
    <th:block th:include="component :: #head"></th:block>

</head>
<body>
<th:block th:include="component :: #header">
</th:block>

<div sec:authorize="isAnonymous()" class="center"
     style="text-align:center;background-color:#00b6ae;padding: 100px 0;color: #fff;">
    <div class="am-g">
        <div class="am-u-lg-12">
            <h1 class="center-title">Amaze UI - HTML5 跨屏前端框架</h1>

            <p>
                期待你的参与，共同打造一个简单易用的前端框架
            </p>

            <p>
                <a th:href="@{/inputCompany}" class="am-btn am-btn-primary am-btn-xl center-btn ">企业入口</a>
                <a href="http://amazeui.org" class="am-btn am-btn-danger am-btn-xl center-btn ">毕业生入口</a>
            </p>
        </div>
    </div>


</div>

<div class="am-container" style="margin-top: 1.5em" sec:authorize="isAuthenticated()">
    <div class="am-fr" style="width: 26%;margin-right: 1rem">
        <div sec:authorize="hasAnyRole('SU','ADMIN')">
            <section class="am-panel am-panel-default" id="admin">
                <header class="am-panel-hd">
                    <h3 class="am-panel-title">公告</h3>
                </header>
                <div class="am-panel-bd">
                    欢迎您,管理员 <a href="#" sec:authentication="name"></a>&nbsp;<a class="am-text-danger" href="/logout">注销</a>
                </div>
            </section>
        </div>
        <div sec:authorize="hasRole('COM')">
            <section class="am-panel am-panel-default" id="com">
                <header class="am-panel-hd">
                    <h3 class="am-panel-title">欢迎您:<a href="#" id="com_name"></a></h3>
                </header>
                <div class="am-panel-bd">
                    企业帐号: <a href="#" sec:authentication="name"></a> &nbsp;<a class="am-text-danger" href="/logout">注销</a>
                </div>
            </section>
        </div>
        <div sec:authorize="hasRole('GDE')">
            <section class="am-panel am-panel-default" id="gde">
                <header class="am-panel-hd">
                    <h3 class="am-panel-title">欢迎您:<a href="#" id="gde_name"></a></h3>
                </header>
                <div class="am-panel-bd">
                    毕业生帐号: <a href="#" sec:authentication="name"></a> &nbsp;<a class="am-text-danger" href="/logout">注销</a>
                </div>
            </section>
        </div>
    </div>
    <div class="am-fl" style="width: 70%">
        <ul class="am-list am-list-static am-list-border">

            <li>
                <span class="am-badge">5天前</span>
                <span class="am-badge am-badge-danger">推荐</span>
                每个人都有一个死角， 自己走不出来，别人也闯不进去。
            </li>
            <li>
                <span class="am-badge">5天前</span>
                每个人都有一个死角， 自己走不出来，别人也闯不进去。
            </li>


        </ul>

        <ul class="am-pagination am-pagination-centered">
            <li class="am-disabled"><a href="#">&laquo;</a></li>
            <li class="am-active"><a href="#">1</a></li>
            <li><a href="#">2</a></li>
            <li><a href="#">3</a></li>
            <li><a href="#">4</a></li>
            <li><a href="#">5</a></li>
            <li><a href="#">&raquo;</a></li>
        </ul>
    </div>
</div>

<th:block th:include="component :: #script"></th:block>
<footer th:include="component :: #footer" class="footer">
</footer>
<small id="mname" type="hidden"  class="am-hide" sec:authentication="name"></small>
<script sec:authorize="isAuthenticated()">
    window.onload = function () {
        $.post("/findUser",{time:new Date().getTime(),username:$("#mname").text()},function (result) {
           if(document.getElementById("com")){
               $("#com_name").text(result.companyname);
           }else if(document.getElementById("gde")){
               alert(result);
               $("#gde_name").text(result.name);
           }

        });
    }
</script>

</body>
</html>